cmake_minimum_required(VERSION 3.20)

# 2. 收集源文件：递归递归获取"linux-uart"目录下所有.c和.cpp文件
# 语法：aux_source_directory(源文件目录 存储文件列表的变量)
aux_source_directory(fp_dir SRC_CPP_LISTS)
aux_source_directory(dev_uart SRC_CPP_LISTS)
aux_source_directory(ai_speech SRC_CPP_LISTS)
aux_source_directory(dev_alsa SRC_CPP_LISTS)
aux_source_directory(speech_parser SRC_CPP_LISTS)
aux_source_directory(lib_json SRC_CPP_LISTS)

# 4. 编译静态库：将收集的源文件打包为静态库
# 语法：add_library(库名 库类型 源文件列表)
add_library(internetofthings_dev STATIC ${SRC_CPP_LISTS})

# 5. 配置头文件搜索路径：为静态库指定定头头文件目录
# 语法：target_include_directories(目标 可见性 头文件目录)
# - ${CMAKE_SOURCE_DIR}/src/linux-uart：头文件所在目录（CMAKE_SOURCE_DIR是项目根目录）
target_include_directories(internetofthings_dev PUBLIC 
    ${CMAKE_SOURCE_DIR}/include
    ${CMAKE_SOURCE_DIR}/include/json
    ${CMAKE_SOURCE_DIR}/src/fp_dir
    ${CMAKE_SOURCE_DIR}/src/dev_uart
    ${CMAKE_SOURCE_DIR}/src/ai_speech
    ${CMAKE_SOURCE_DIR}/src/dev_alsa
    ${CMAKE_SOURCE_DIR}/src/speech_parser
)